﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Flow_AddPostilFile]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Flow_AddPostilFile];
GO
CREATE PROCEDURE [dbo].[sproc_Flow_AddPostilFile]
    @PostilID int,
    @FileName nvarchar(255),
    @FileSize int,
    @FileAttribute int,
    @FileVisualPath nvarchar(255),
    @FileAuthor nvarchar(255),
    @FileCatlog nvarchar(255),
    @FileAddedDate datetime
    
AS
INSERT INTO uds_Flow_Files 
    (DOCID,[FILENAME],FILESIZE,FILEATTRIBUTE, FILEVISUALPATH,FILEAUTHOR,FILECATLOG,FILEADDEDDATE)
    VALUES(0,@FileName,@FileSize,@FileAttribute,@FileVisualPath,@FileAuthor,@FileCatlog,@FileAddedDate)
UPDATE uds_flow_postil 
    SET [file_id] = IDENT_CURRENT('uds_Flow_Files')
    WHERE Postil_ID = @PostilID

    RETURN IDENT_CURRENT('uds_Flow_Files')